package com.oa.ylms.apps.actions.news;

import java.util.List;

import com.oa.ylms.apps.actions.BasicAction;
import com.oa.ylms.apps.business.news.INewsCategoryService;
import com.oa.ylms.apps.entity.news.NewsCategoryValue;

@SuppressWarnings("serial")
public class NewsCategoryAction extends 
BasicAction {
	private INewsCategoryService service;
	private NewsCategoryValue category;
	private List<NewsCategoryValue> list;
	private int categoryId;
	private String categoryName;
	private int states;


  
	public String execute() {
		try {
			list = service.queryAllCategory();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "show";
	}
	
	public String queryCategoryById (){
		try {
			service.queryCategoryById(categoryId);
		}catch (Exception e){
			e.printStackTrace();
		}
			
		return "category";
	}
	
   public String add(){
	   try {
		   service.addNewsCategory(categoryName, states);
	   }catch (Exception e){
			e.printStackTrace();
		}
	   return "add";
   }
		

	public String modify() {
		try {
			
			service.modifyNewsCategory(categoryId, categoryName, states);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "modify";
	}
	
	
   
	public String delete()  {
		try {
			service.deleteNewsCategory(categoryId);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return "delete";
	}
//

	public INewsCategoryService getService() {
		return service;
	}

	public void setService(INewsCategoryService service) {
		this.service = service;
	}

	public NewsCategoryValue getCategory() {
		return category;
	}

	public void setCategory(NewsCategoryValue category) {
		this.category = category;
	}

	public List<NewsCategoryValue> getList() {
		return list;
	}

	public void setList(List<NewsCategoryValue> list) {
		this.list = list;
	}

	public int getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(int categoryId) {
		this.categoryId = categoryId;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public int getStates() {
		return states;
	}

	public void setStates(int states) {
		this.states = states;
	}
	





	
}
